// 类组件计数器，点击按钮，计数器加1
import React from 'react'
class Counter extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            count: 0
        }
    }
    render() {
        return <div>
            <p>{this.state.count}</p>
            <button onClick={() => { this.setState({ count: this.state.count + 1 }) }}>点我+1</button>
        </div>
    }
}

export default Counter